package com.haina.vote.mapper;

import com.haina.vote.entity.IpInfo;
import com.haina.vote.entity.Vote;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SysLogMapper {
    @Select("select * from tb_ip_info")
    @Results({
            @Result(id = true,property = "id",column = "id"),
            @Result(property = "ipaddress",column = "ipaddress"),
            @Result(property = "number",column = "number"),
            @Result(property = "request_time",column = "request_time"),
            @Result(property = "vote",column = "vote_id",javaType = Vote.class,one =@One(select = "com.haina.vote.mapper.VoteMapper.findVoteById"))
    })
   public List<IpInfo> findAllIpInfo();
}
